#! /bin/sh

name=mlibc
skip_pkg_check=yes
version=0.0git
revision=1
git_url="https://github.com/managarm/mlibc.git"
commit=1183d85f914f3c7cea56961edbf472b49b22d92b
imagedeps="meson ninja-build"
hostdeps="gcc pkg-config libgcc-binaries"
builddeps="freestnd-c-hdrs freestnd-cxx-hdrs frigg"
deps="mlibc-headers"

configure() {
        CFLAGS="$TARGET_CFLAGS" \
        CXXFLAGS="$TARGET_CXXFLAGS" \
        LDFLAGS="$TARGET_LDFLAGS -Wl,/usr/local/libgcc-binaries/libgcc-$ARCHITECTURE.a" \
    meson_configure_noflags \
        --buildtype=release \
        -Dno_headers=true \
        -Ddefault_library=both \
        -Dlibgcc_dependency=false \
        -Duse_freestnd_hdrs=enabled
}

build() {
    ninja -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" ninja install
}
